<template>
  <v-main>
    <div class="sign-up">
        <h1>注册</h1>
        <v-text-field v-model="username" label="用户名" outlined clearable></v-text-field>
        <v-text-field v-model="password" label="密码" type="password" outlined clearable></v-text-field>
        <v-text-field v-model="email" label="邮箱" outlined clearable></v-text-field>
        <v-btn color="primary" @click="register">注册</v-btn>
        <v-btn color="primary" @click="Login" text>去登录</v-btn>
    </div>
  </v-main>
</template>
<script>
export default {
    //本地变量对应标签绑定的v-model
    data(){
      return {
        username:'',
        password:'',
        email:''
      }
    },
    methods: {
        Login(){
            this.$router.push({name:'Login'})
        },
        register(){
            let post_data = {
              username:this.username,
              password: this.password,
              email: this.email
            }
            this.$api.user.signUp(post_data).then(res=>{
              console.log(res)
            })
        }
    }
}
</script>
<style scoped>
.sign-up{
    width: 500px;
    margin: 0 auto;
    text-align: center;
}
</style>